FROM adoptopenjdk:11-jre-hotspot

ARG APP_PATH
ARG APP_NAME
ARG APP_PORT
ARG APP_Xmx_MEM

ENV APP_NAME ${APP_NAME}
ENV APP_Xmx_MEM ${APP_Xmx_MEM}
ENV TZ=Asia/Shanghai

WORKDIR /app

COPY ${APP_PATH}/target/${APP_NAME}.jar ./${APP_NAME}.jar
COPY docker/entrypoint.sh ./entrypoint.sh

RUN touch ./${APP_NAME}.jar && \
    touch ./entrypoint.sh && \
    chmod +x ./entrypoint.sh

VOLUME /app/log /app/upload

EXPOSE ${APP_PORT}

ENTRYPOINT ["/app/entrypoint.sh"]
